<%--
  Created by IntelliJ IDEA.
  User: shen
  Date: 2020/2/8
  Time: 9:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE html>
<html>
<head>
    <base href="${basePath}">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>批量导入试题</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <%@include file="../common_resource.jsp" %>

    <script type="text/javascript">

        $.getJSON('Kld/selectAllLev/0', function (res) {
            var qxid = $('#questCatagory');

            $.each(res, function (index,item) {
                console.log('%i - %o', index, item);
                qxid.append('<option value="' + item.levKldID +'">' + item.levKldCtgr + '</option>');
            })
        });

        // 加二级知识点下拉列表
        function changeLevKld(ele) {
            var  levKldID= ele.options[ele.selectedIndex].value;
            $.getJSON('Kld/selectAllSecByLevID/0',{levKldID:  levKldID},function (res) {
                var secKldID = $('#secKldID');
                secKldID.empty();
                $.each(res, function (index,item) {
                    console.log('%i - %o', index, item);
                    secKldID.append('<option value="' + item.secKldID +'">' + item.secKldCtgr + '</option>');
                })
            });
        }


    </script>

    <script type="text/javascript">
        /*判断是否成功导入试题*/
        <c:if test="${not empty sessionScope.importQ}">
        $(function(){
            $("#insertSuccessModal").modal();
        });
        </c:if>
        <c:if test="${0 eq sessionScope.importQ}">
        $(function(){
            $("#insertFailModal").modal();
        });
        </c:if>
    </script>

</head>
<body class="main_body">
<div class="container" style="width:1180px;">
    <div class="panel panel-info" style="margin-top: 10px;">
        <div class="panel-heading">
            <span ><i class="fa fa-user"></i></span> <label><font style="font-weight: bold;margin-left: 10px;">试&nbsp;题&nbsp;批&nbsp;量&nbsp;导&nbsp;入</font></label>
        </div>
        <div class="panel-body">
            <div>
                <div style="float:right;">
                    <label><font color="red"></b>*</font>&nbsp;一级知识点(请单击选择)</label>
                    <label id="questCtgrError" class="catagoryMsg"></label>

                    <label><font color="red"></b>*</font>&nbsp;二级知识点(可多选)</label></br>
                    <select id="questCatagory"  name="levKldID"    required="true" size="11" style="margin-left:10px;width:220px;" onchange="changeLevKld(this)">

                    </select>

                    <select id="secKldID" size="11" name="secKld" required="true"  style="width:220px;" multiple="multiple">
                        <option>--不限--</option>
                    </select>
                    <br/>
                </div>
                <div>

                    <form id="importSForm" class="form-inline" action="question/importQuestion/1"
                          method="post" enctype="multipart/form-data">
                        <div>
                            <br/>
                            <label style="font-size: 13px;">批量导入单选题表：
                                <font color="red"><b>*</b></font></label>
                            <label>
                                <div class="kv-main">
                                    <input type="file"  name="file">
                                </div>
                            </label>
                            <span style="margin-left:60px;">
							   	<input type="submit" class="btn btn-info btn-sm"  id="importSButton" value="导入" >&nbsp;&nbsp;&nbsp;&nbsp;
							   	<input type="reset" class="btn btn-warning btn-sm" value="重置" cssClass="button_h">
						   </span>
                        </div>
                    </form>
                    <form id="importDForm" class="form-inline" action="question/importQuestion/2"
                          method="post" enctype="multipart/form-data">
                        <div>
                            <br/>
                            <label style="font-size: 13px;">批量导入判断题表：
                                <font color="red"><b>*</b></font></label>
                            <label>
                                <div class="kv-main">
                                    <input type="file"  name="file">
                                </div>
                            </label>
                            <span style="margin-left:60px;">
							   	<input type="submit" class="btn btn-info btn-sm"  id="importDButton" value="导入" >&nbsp;&nbsp;&nbsp;&nbsp;
							   	<input type="reset" class="btn btn-warning btn-sm" value="重置" cssClass="button_h">
						   </span>
                        </div>
                    </form>
                    <form id="importFForm" class="form-inline" action="question/importQuestion/3"
                          method="post" enctype="multipart/form-data">
                        <div>
                            <br/>
                            <label style="font-size: 13px;">批量导入填空题表：
                                <font color="red"><b>*</b></font></label>
                            <label>
                                <div class="kv-main">
                                    <input type="file"  name="file">
                                </div>
                            </label>
                            <span style="margin-left:60px;">
							   	<input type="submit" class="btn btn-info btn-sm"  id="importFButton" value="导入" >&nbsp;&nbsp;&nbsp;&nbsp;
							   	<input type="reset" class="btn btn-warning btn-sm" value="重置" cssClass="button_h">
						   </span>
                        </div>
                    </form>

                    <div id="explainDiv">
                        <br />
                        说明：Excel格式如下图所示：<br/>
                        导入的试题信息如下图（单选、判断、填空、简答以及综合）的第一个工作表 “sheet” 中。<br/>
                        试题信息必须从第2行开始，(此处以.xls格式为模板，也可以使用.xlsx的格式)进行严格 按照规则<br/>
                        填写，不得打乱顺序，不得中间单独空出行数，否则导入失败。<br/>
                        注意：表格里涉及到的一级知识点以及二级知识点必须严格按照以上给出的数据进行填写，<br/>
                        涉及多个二级知识点的内容之间请用逗号(使用英文逗号)分隔，否则导入失败。<br/>
                        单选题：<br/>
                        <img src="images/question1.png" width="830"/><br/>
                        判断题：<br/>
                        <img src="images/question2.png" width="830"height="400px"/><br/>
                        填空题：<br/>
                        <img src="images/question3.png" width="830"/><br/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script src="bootstrap/js/bootstrap.min.js"></script>

<!-- 添加成功模态 -->
<div class="modal fade" id="insertSuccessModal" tabindex="-1" role="dialog"
     aria-labelledby="insertSuccessModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×
                </button>
                <h2 class="modal-title" id="myModal1">
                    <i class="fa fa-twitch"></i> &nbsp;&nbsp;提示
                </h2>
            </div>
            <div class="modal-body" style="text-align:center;">
                <h3>批量导入试题成功</h3>
            </div>
            <div class="modal-footer">
                <button id="closeModal" type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- 添加失败模态 -->
<div class="modal fade" id="insertFailModal" tabindex="-1" role="dialog"
     aria-labelledby="insertFailModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×
                </button>
                <h2 class="modal-title" id="myModal2">
                    <i class="fa fa-twitch"></i> &nbsp;&nbsp;提示
                </h2>
            </div>
            <div class="modal-body" style="text-align:center;">
                <h3>批量导入试题失败</h3>
            </div>
            <div class="modal-footer">
                <button  type="button" class="btn btn-default" data-dismiss="modal">关闭
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</body>
</html>
<c:remove var="importQ" scope="session"/>
